﻿<navigation:Page  x:Class="SomethingSpacial.Views.Admin.LocationList" 
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
            xmlns:activity="clr-namespace:System.Windows.Controls;assembly=ActivityControl"
            xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
            xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit" 
            xmlns:vm="clr-namespace:SomethingSpacial.ViewModel"
            Title="Locations List Page">

            <navigation:Page.DataContext>
                <vm:LocationsViewModel x:Name="vmLocations"  />
            </navigation:Page.DataContext>

            <StackPanel x:Name="LayoutRoot" Margin="0"  Height="479"  Style="{StaticResource ContentStackPanelStyle}" >

                <!-- Page Content -->
                <StackPanel x:Name="stackPanelContent"  Orientation="Horizontal">

                    <!-- Listing Panel-->
                    <Border x:Name="borderList" HorizontalAlignment="Left" Margin="0,0,10,10" VerticalAlignment="Top" CornerRadius="10" BorderThickness="1" BorderBrush="Black" Padding="10" Background="#FFFAFAFA" Width="500">
                        <StackPanel x:Name="stackPanelList" Orientation="Vertical" VerticalAlignment="Top" Background="White" Margin="0" d:LayoutOverrides="Width" Height="450" HorizontalAlignment="Left">
                            <TextBlock x:Name="textBlockListingHeader" Text="Location Listing" TextWrapping="Wrap" FontWeight="Bold" FontSize="13.333" Foreground="#FF1D1472" HorizontalAlignment="Left"/>

                            <activity:Activity x:Name="activityContent" IsActive="{Binding IsBusy, ElementName=dds}" VerticalAlignment="Top" HorizontalAlignment="Left">
                                <data:DataGrid x:Name="gridLocations" Height="378" Width="450" IsReadOnly="True" AutoGenerateColumns="False" HorizontalAlignment="Left" 
            					            HorizontalScrollBarVisibility="Disabled"   VerticalAlignment="Top"                                                   
            					            ItemsSource="{Binding Locations}" Margin="0"  >
                                    <data:DataGrid.Columns>
                                        <data:DataGridTextColumn Header="ID"  Binding="{Binding LocationID}" Width="50"  />
                                        <data:DataGridTextColumn Header="Location Name" Binding="{Binding LocationName}" Width="100" />
                                        <data:DataGridTextColumn Header="City" Binding="{Binding City}" Width="200" />
                                    </data:DataGrid.Columns>
                                </data:DataGrid>
                            </activity:Activity>

                            <StackPanel x:Name="stackPanelActionButtons" Orientation="Horizontal" VerticalAlignment="Bottom" Grid.Row="2" d:LayoutOverrides="Width" Margin="0,0,0,1" Height="39">
                                <Button x:Name="buttonAddNew" Content="Add New" Width="105" Height="28" 	Margin="5,0,0,0" HorizontalAlignment="Left" Click="AddNew_Click" />
                                <Button x:Name="buttonSubmit" Content="Update" Width="105" Height="28" Click="SubmitButton_Click"	/>
                                <Button x:Name="buttonDelete" Content="Delete" Width="105" Height="28"	Margin="5,6,0,5"	/>
                            </StackPanel>
                        </StackPanel>

                    </Border>

                    <!-- Details StackPanel-->
                    <Border x:Name="borderDetails" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" Width="500" d:LayoutOverrides="GridBox" CornerRadius="10" BorderThickness="1" BorderBrush="Black" Padding="10" Background="#FFFAFAFA">
                        <StackPanel x:Name="stackPanelDetails" Orientation="Vertical" VerticalAlignment="Top" Height="450" Width="450" HorizontalAlignment="Left">
                            <TextBlock x:Name="textBlockHeaderDetails" FontSize="13.333" FontWeight="Bold" Foreground="#FF1D1472" Text="Location Details" TextWrapping="Wrap" Margin="0,0,40,0" d:LayoutOverrides="Width" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                            <dataControls:DataForm x:Name="editDataForm" Height="378" Width="450" 	VerticalAlignment="Top"  Header=""
                    			            CurrentItem="{Binding SelectedItem, ElementName=gridLocations}" d:LayoutOverrides="GridBox" HorizontalAlignment="Left" Margin="0" HeaderVisibility="Collapsed" >
                                <dataControls:DataForm.EditTemplate>
                                    <DataTemplate>
                                        <StackPanel>
                                            <dataControls:DataField Label="Location Name:" >
                                                <TextBox Text="{Binding LocationName, Mode=TwoWay}"  Width="200" HorizontalAlignment="Left" />
                                            </dataControls:DataField>
                                            <dataControls:DataField Label="Street Address 1:">
                                                <TextBox Text="{Binding  StreetAddress1, Mode=TwoWay}" Width="180" Height="120" HorizontalAlignment="Left"  TextWrapping="Wrap" />
                                            </dataControls:DataField>
                                            <dataControls:DataField Label="Street Address 2:">
                                                <TextBox Text="{Binding StreetAddress2, Mode=TwoWay}" HorizontalAlignment="Left" Width="200"  />
                                            </dataControls:DataField>
                                            <dataControls:DataField Label="City:">
                                                <TextBox Text="{Binding City, Mode=TwoWay}" HorizontalAlignment="Left" Width="200"  />
                                            </dataControls:DataField>
                                            <dataControls:DataField Label="State:">
                                                <TextBox Text="{Binding State, Mode=TwoWay}" HorizontalAlignment="Left" Width="40"  />
                                            </dataControls:DataField>
                                            <dataControls:DataField Label="Country:">
                                                <TextBox Text="{Binding Country, Mode=TwoWay}" HorizontalAlignment="Left"  Width="100" />
                                            </dataControls:DataField>
                                            <dataControls:DataField Label="Postal Code:">
                                                <TextBox Text="{Binding PostalCode, Mode=TwoWay}" HorizontalAlignment="Left" Width="100"  />
                                            </dataControls:DataField>
                                            <dataControls:DataField Label="Lat Value:">
                                                <TextBox Text="{Binding Lat, Mode=TwoWay}" HorizontalAlignment="Left"  Width="80" />
                                            </dataControls:DataField>
                                            <dataControls:DataField Label="Long Value:">
                                                <TextBox Text="{Binding Long, Mode=TwoWay}" HorizontalAlignment="Left"  Width="80" />
                                            </dataControls:DataField>
                                        </StackPanel>
                                    </DataTemplate>
                                </dataControls:DataForm.EditTemplate>


                            </dataControls:DataForm>
                        </StackPanel>

                    </Border>

                </StackPanel>

            </StackPanel>

</navigation:Page>
